
<template>
  <div>
    <!--批量报价-->
    <el-dialog
      title="批量报价"
      :visible.sync="dialogVisible"
      width="1200px">
      <div>
        <el-form size="mini" :model="sendForm" label-width="100px"  ref="sendForm" :rules="rules">
          <div>
            <el-table :data="sendForm.goodLineList" border style="width: 100%;margin:20px 0">
              <el-table-column
                width="150"
                align="center">
                <template slot="header" slot-scope="scope">
                  <span>牌号</span>
                </template>
                <template slot-scope="scope">
                  <el-form-item :prop="`goodLineList.${scope.$index}.goodsLineId`" :rules="rules.goodsLineId" label-width="0px" style="margin-bottom:0px">

                  </el-form-item>
                </template>
              </el-table-column>

              <el-table-column
                label="供应商"
                width="150"
                align="center">
                <template slot-scope="scope">
                  <el-form-item label-width="0px" style="margin-bottom:0px">

                  </el-form-item>
                </template>
              </el-table-column>

              <el-table-column
                label="发货地区"
                width="150"
                align="center">
                <template slot-scope="scope">
                  <el-form-item label-width="0px" style="margin-bottom:0px">

                  </el-form-item>
                </template>
              </el-table-column>

              <el-table-column
                label="发货方式"
                width="100"
                align="center">
                <template slot-scope="scope">
                  <el-form-item label-width="0px" style="margin-bottom:0px">

                  </el-form-item>
                </template>
              </el-table-column>

              <el-table-column
                label="结算方式"
                width="100"
                align="center">
                <template slot-scope="scope">
                  <el-form-item label-width="0px" style="margin-bottom:0px">

                  </el-form-item>
                </template>
              </el-table-column>

              <el-table-column  label="价格类型" width="150" align="center">
                <template slot-scope="scope">
                  <el-form-item label-width="0px" style="margin-bottom:0px">
                      <el-select></el-select>
                  </el-form-item>
                </template>
              </el-table-column>
              <el-table-column  label="发货时间" width="150" align="center">
                <template slot-scope="scope">
                  <el-form-item label-width="0px" style="margin-bottom:0px">
                    <el-date-picker
                      style="width:120px"
                      v-model="value1"
                      type="date"
                      placeholder="选择日期">
                    </el-date-picker>
                  </el-form-item>

                </template>
              </el-table-column>
              <el-table-column
                label="报价"
                width="150"
                align="center">
                <template slot-scope="scope">
                  <el-form-item label-width="0px" style="margin-bottom:0px">
                     <el-input></el-input>
                  </el-form-item>
                </template>
              </el-table-column>
              <el-table-column
                label="库存"
                width="100"
                align="center">
                <template slot-scope="scope">
                  <el-form-item label-width="0px" style="margin-bottom:0px">
                    <el-input></el-input>
                  </el-form-item>
                </template>
              </el-table-column>

              <el-table-column  label="操作" width="100" align="center" fixed="right">
                <template slot-scope="scope">
                  <el-button type="text" @click="delGoods(scope.$index)">删除</el-button>
                </template>
              </el-table-column>
            </el-table>
          </div>
        </el-form>

      </div>
      <span slot="footer" class="dialog-footer">
          <el-button @click="handleClose">取 消</el-button>
          <el-button type="primary" @click="handleConfirm" :loading="btnLoading">确 认</el-button>
      </span>
    </el-dialog>
  </div>

</template>
<script>
import {getAddressList,orderGoodsList,getCustomerOption} from '@/api/allInLine/partner'

import { mapGetters } from 'vuex'

const defaultSendForm={
  goodLineList:[{},{}],
};
const defeaultGoodLineItem = {
  goodsLineId:'',
  cglTrackingTime:'',
  cglMonthBuyNum:'',
  cglCompetitorInfo:'',
  cglCustomerDegree:'',
  cglCompetitorType:'',
  cglScale:'',
  cglOperatingRate:'',
  cglPayMethod:'',
}
export default {
  name: "index",
  data(){
    return {
      dialogVisible:false,
      btnLoading:false,
      sendForm:JSON.parse(JSON.stringify(defaultSendForm)),
      rules:{},
      querySearchList:[],
      goodsList:[],
      diQuIds:[],

    }
  },
  computed: {
    ...mapGetters([
      'name',
      'mobile',
      'userId'
    ]),
  },
  components : {

  },
  created() {
    // orderGoodsList().then((res)=>{
    //   this.goodsList = res.list
    // })
    // this.getAddressListData()
  },
  filters: {

  },
  methods:{
    showPop9(){
      this.$refs.addGoodsSn.showPop()
    },
    showPop8(){
      this.$refs.addCustomer.showPop8()
    },

    //客户名称输入匹配
    querySearch(queryString){
      if(queryString && queryString!= ''){
        getCustomerOption({keywords:queryString,tab:'my'}).then((res)=>{
          this.querySearchList = res;
        })
      }
    },

    //显示询价
    showPop(){
      this.dialogVisible = true;
    },
    //关闭询价
    handleClose(){
      this.dialogVisible = false;
    },

    //确认询价
    handleConfirm(){

    },
    //获取省市区列表
    getAddressListData(){
      getAddressList().then((res)=>{
        this.options = res;
      })
    },
    //删除商品
    delGoods(index){
      this.sendForm.goodLineList.splice(index,1)
    },
    //增加商品
    addGoods(){
      this.sendForm.goodLineList.push(JSON.parse(JSON.stringify(defeaultGoodLineItem)))
    },
  },
}
</script>

<style  lang="scss">

</style>

